$rowHeight: 22px;
$maxCount: 3;
$maxHeight: $rowHeight * $maxCount + 4px * ($maxCount + 1) + 2px;

@mixin text-ell() {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  word-break: break-all;
}

.strong-search {
  // width: 400px;
  border: 1px solid;
  border-color: var(--el-border-color);
  border-radius: 4px;
  box-sizing: border-box;
  max-height: $maxHeight;
  display: inline-flex;
  transition: var(--el-transition-border);

  .filter-icon {
    display: inline-flex;
    margin-left: 8px;
    align-items: center;
    img {
      width: 16px;
      height: 16px;
    }
  }

  .search-scrollbar {
    flex: 1;
    // max-width: calc(100% - 16px - 8px);
    position: relative;
    overflow: visible;
    .el-scrollbar__wrap {
      max-height: $maxHeight - 2px;
    }
    .el-scrollbar__view {
      padding: 3px 6px;
      display: flex;
      justify-content: flex-start;
      flex-wrap: wrap;
      align-items: center;
      gap: 4px;
    }
  }

  .search-input {
    flex: 1;
    min-width: 160px;
    font-size: 12px;
    height: $rowHeight;
    line-height: $rowHeight;
    .el-input__inner {
      height: $rowHeight;
      line-height: $rowHeight;
    }

    .el-input__wrapper {
      box-shadow: none;
      padding: 0;
    }

    .el-input__prefix-inner {
      padding-right: 4px;
      color: #323538;
    }

    .el-input__suffix-inner {
      column-gap: 6px;
      & > :first-child {
        margin-left: 6px;
      }
      .e-icon {
        width: 18px;
        height: 18px;
        display: inline-flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }

  .tag-item {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 400;
    max-width: 100%;
    border-radius: 2px;

    width: auto;
    line-height: 1;
    height: $rowHeight;
    padding: 0 4px 0 8px;
    background-color: #f3f4f7;
    white-space: nowrap;

    .tag-content {
      display: flex;
      max-width: calc(100% - 4px - 14px);
    }

    .tag-prefix {
      color: #323538;
      margin-right: 4px;
    }

    .tag-value {
      color: #323538;
      flex: 1;
      @include text-ell();
    }

    .close-btn {
      color: #a6adb8;
      font-size: 6px;
      cursor: pointer;
      margin-left: 4px;
      display: inline-flex;
      border-radius: 2px;
      width: 14px;
      height: 14px;
      justify-content: center;
      align-items: center;
      &:hover {
        background: rgba(31, 35, 41, 0.08);
        color: #323538;
      }
    }
  }

  &:hover {
    border-color: #c0c4cc;
  }

  &.active {
    border-color: var(--el-color-primary);
    .search-input {
      .el-input__wrapper {
        box-shadow: none;
        &.is-focus {
          box-shadow: none;
        }
      }
    }
  }
}

.search-popover {
  &.el-popover.el-popper {
    padding: 0;
    color: #323538;
  }

  .el-popper__arrow {
    left: 8px !important;
  }

  .filter-list {
    margin: 6px 0;
    .filter-title {
      margin: 12px 0 6px 12px;
      font-size: 12px;
      color: #8a8e99;
      font-weight: 600;
    }

    .filter-content {
      font-size: 12px;
      font-weight: 400;
      .filter-item {
        cursor: pointer;
        padding: 8px 12px;
        @include text-ell();
        line-height: 16px;
        &.active {
          color: var(--el-color-primary);
          background-color: rgba(21, 98, 252, 0.04);
        }
      }
    }
  }

  .search-select {
    font-size: 12px;
    font-weight: 400;
    .search-option {
      cursor: pointer;
      padding: 8px 12px;
      @include text-ell();
      line-height: 16px;
      &.active {
        color: var(--el-color-primary);
        background-color: rgba(21, 98, 252, 0.04);
      }
    }
  }

  .search-check {
    .check-option {
      line-height: 16px;
      display: flex;
      width: 100%;
      align-items: center;
      cursor: pointer;
      padding: 8px 12px;
      justify-content: space-between;
      &.active {
        color: var(--el-color-primary);
        background-color: rgba(21, 98, 252, 0.04);
      }
    }

    .check-label {
      font-size: 12px;
      font-weight: 400;
      @include text-ell();
      flex: 1;
    }

    .check-icon {
      width: 16px;
      height: 16px;
      margin-left: 10px;
    }
  }

  .search-date {
    .date-title {
      margin-top: 8px;
      margin-left: 8px;
      color: #8a8e99;
      font-weight: 700;
      font-size: 13px;
    }
    .tip-title {
      font-size: 13px;
      margin-bottom: 4px;
    }

    .date-content {
      padding: 8px 12px;
      .date-start {
        margin-bottom: 10px;
      }
      .date-end {
        margin-bottom: 2px;
      }

      .el-date-editor {
        width: 100%;
        display: block;
      }
    }
  }

  .search-popover-footer {
    padding: 8px 0;
    border-top: 1px solid var(--el-border-color);
    text-align: center;
  }
}

.column-select-popover {
  &.el-popover.el-popper {
    @apply px-0 pb-2;
  }
}
